package main

import (
	"fmt"
)


var data = [...]int{1,100,7,6,5,15,59,2,9,13}

func insertDui(pd **Node,start int,end int){
	if start > end {
		return
	}
	node := &Node{}
	node.data = data[(start+end)/2]

	*pd = node

	insertDui(&(node.left),start ,(start+end)/2 -1)

	insertDui(&(node.right),(start+end)/2 + 1,end)

}


type Node struct{
     left *Node
     data int
     right *Node
}

func show(p *Node){
    if p!=nil {
      fmt.Println(p.data)
      if p.left != nil {
	      show(p.left)
      }
      if p.right != nil {

	      show(p.right)
      }

    }

}

var p *Node


func main(){
   insertDui(&p,0,len(data)-1)

   show(p)


   fmt.Println(data)


}
